package a4jsf;

import javax.faces.component.UIInput;
import javax.faces.event.ActionEvent;

public class CountryState {
	
	private String city;
	private String state="default";
	private String state1;

   private UIInput cityInput=null;
   private UIInput stateInput=null;
   private UIInput stateInput1=null;
   
   // counrty ValueChangeListner...
   public void countryChanged(ActionEvent event) {
//	   System.out.println("HIIIIII");
	   UIInput input = (UIInput)event.getComponent() // Ajax4jsf comp
	   .getParent(); // input comp
	   
	   
	   System.out.println("state=" + state);
	   System.out.println("getSubmitted Val: " + stateInput.getSubmittedValue());
	  // setState("YOGI");
	   setState1("xx");
	   
	   if (input != null) {
		   String cityInput = (String)input.getSubmittedValue();
//		   System.out.println("City: " + cityInput);
		   
		   stateInput.setSubmittedValue(null);
		   stateInput1.setSubmittedValue(null);
//		   this.setState(cityInput);
//		   System.out.println("City: " + cityInput);
//		   stateInput.setValue(cityInput);
	   }
   }

// GETTERS & SETTERS \\
   
public String getCity() {
	return city;
}

public void setCity(String city) {
	this.city = city;
}

public String getState() {
	return state;
}

public void setState(String state) {
	this.state = state;
}

public UIInput getCityInput() {
	return cityInput;
}

public void setCityInput(UIInput cityInput) {
	this.cityInput = cityInput;
}

public UIInput getStateInput() {
	return stateInput;
}

public void setStateInput(UIInput stateInput) {
	this.stateInput = stateInput;
}

public String getState1() {
	return state1;
}

public void setState1(String state1) {
	this.state1 = state1;
}

public UIInput getStateInput1() {
	return stateInput1;
}

public void setStateInput1(UIInput stateInput1) {
	this.stateInput1 = stateInput1;
}




}
